<!--#Include File="../../../Include.asp"--><%
'--------------------------------------
'Power By 方卡在线 @2010-2014 f02
'URL:http://www.fangka.net/
'EMail:admin@ifangka.com
'QQ:861118936
'版权所有 未经允许不得去除本版权信息
'--------------------------------------

Dim f_Width,f_Height,f_Count
Dim f_Pic,f_Text,f_Url,f_textLen
Dim FocusPic,FocusText,FocusUrl

'=============================================
'使用 "skin"参数来指定皮肤，或者在代码里改
'调用示例（此处有skin参数）：<script type="text/javascript" src="{$SiteDir$}Plugin/FlashFocus/slide/focus.asp?Type=0&Menu=1&Module=2&Width=400&Height=290&skin=mF_liuzg"></script>
'注意事项：更换皮肤后，可能需要增加部分其它参数，请自行查看对应js文件修改，如默认皮肤的“direction”参数\
'API地址：http://demo.jb51.net/js/myfocus/api.html
'--------------------------------------------
'默认皮肤 mF_YSlider，
'皮肤列表：
'mF_51xflash
'mF_classicHB
'mF_classicHC
'mF_dleung
'mF_expo2010
'mF_fancy
'mF_fscreen_tb
'mF_games_tb
'mF_kdui
'mF_kiki
'mF_ladyQ
'mF_liquid
'mF_liuzg
'mF_luluJQ
'mF_pconline
'mF_peijianmall
'mF_pithy_tb
'mF_qiyi
'mF_quwan
'mF_rapoo
'mF_shutters
'mF_slide3D
'mF_sohusports
'mF_taobao2010
'mF_taobaomall
'mF_tbhuabao
'mF_YSlider

Dim focusSkin
focusSkin=Request.QueryString("skin")
If focusSkin="" Then focusSkin = "mF_YSlider"	'不传递皮肤参数则默认使用mF_YSlider
'=============================================


FocusPic=""
FocusText=""
FocusUrl=""

Types=Clng(Request.QueryString("Type"))
f_Width=Request.QueryString("Width")
f_Height=Request.QueryString("Height")
f_textLen=Request.QueryString("textLen")
f_Count=5

If f_Width="" Then
	f_Width=100
Else
	f_Width=Clng(f_Width)
End If
If f_Height="" Then
	f_Height=100
Else
	f_Height=Clng(f_Height)
End If

If f_textLen<>"0" Then
	f_textLen = CLng(f_textLen)
Else
	f_textLen = 0
End If

If Types=0 Then '读取菜单项带图片数据
	MenuId=Clng(Request.QueryString("Menu"))
	ModuleId=Clng(Request.QueryString("Module"))
	Set FKTemplate=New Cls_Template
	Sqlstr="Select Top "&f_Count&" Fk_View_Id,Fk_View_Title,Fk_View_Pic,Fk_View_Url,Fk_View_Link,Fk_Module_Url From [Fk_ViewList] Where Fk_View_Show=1 And Fk_Module_State=1 And (Fk_View_Pic Like '%%.gif' Or Fk_View_Pic Like '%%.jpg')"
	If MenuId>0 Then
		Sqlstr=Sqlstr&" And Fk_View_Menu="&MenuId&""
	End If
	If ModuleId>0 Then
		Sqlstr=Sqlstr&" And Fk_View_Module="&ModuleId&""
	End If
	Sqlstr=Sqlstr&" Order By Fk_View_Id Desc"
	Rs.Open Sqlstr,Conn,1,1
	While Not Rs.Eof
		'数据获取
		f_Pic=Rs("Fk_View_Pic")
		f_Text=Rs("Fk_View_Title")
		If Rs("Fk_View_Link")<>"" Then
			f_Url=Rs("Fk_View_Link")
		Else
			f_Url=FKTemplate.GetUrl(FullSiteDir,"",Rs("Fk_Module_Url"),Rs("Fk_View_Url"),FullHtmlSuffix,2,Rs("Fk_View_Id"),"")
		End If
		
		'数据输出
		If FocusPic="" Then
			FocusPic=f_Pic
		Else
			FocusPic=FocusPic&"|"&f_Pic
		End If
		If f_textLen<>0 Then
			f_Text = FKFun.GetStr(f_Text,f_textLen)
		End If
		If FocusText="" Then
			FocusText=f_Text
		Else
			FocusText=FocusText&"|"&f_Text
		End If
		If FocusUrl="" Then
			FocusUrl=f_Url
		Else
			FocusUrl=FocusUrl&"|"&f_Url
		End If
		
		Rs.MoveNext
	Wend
	Rs.Close
ElseIf Types=1 Then '读取独立轮换代码
	Id=Clng(Request.QueryString("Id"))
	Sqlstr="Select Fk_Focus_Name,Fk_Focus_Content From [Fk_Focus] Where Fk_Focus_Id=" & Id
	Rs.Open Sqlstr,Conn,1,1
	If Not Rs.Eof Then
		TempArr=Split(Rs("Fk_Focus_Content"),"|FocusList|")
	Else
		Rs.Close
		Call FKFun.PageEnd()
	End If
	Rs.Close
	For Each Temp In TempArr
		If Temp<>"" Then
			f_Text=FKFun.GetSub(Temp,"Focus_Title:","|;|","")
			f_Url=FKFun.GetSub(Temp,"Focus_Url:","|;|","")
			f_Pic=FKFun.GetSub(Temp,"Focus_Pic:","|;|","")
		
			'数据输出
			If FocusPic="" Then
				FocusPic=f_Pic
			Else
				FocusPic=FocusPic&"|"&f_Pic
			End If
			If FocusText="" Then
				FocusText=f_Text
			Else
				FocusText=FocusText&"|"&f_Text
			End If
			If FocusUrl="" Then
				FocusUrl=f_Url
			Else
				FocusUrl=FocusUrl&"|"&f_Url
			End If
		End If
	Next
End If
'转码
'FocusPic=Server.URLEncode(FocusPic)
'FocusText=Server.URLEncode(FocusText)
'FocusUrl=Server.URLEncode(FocusUrl)

Dim surl,sname
surl = Request.ServerVariables("URL")
sname = Replace(surl,"focus.asp","")
response.ContentType="application/x-javascript"
%>
window.sliderKey=0;
window.sliderjs='';
window.sliderSkin='<%=focusSkin%>';
if(typeof(mkSliderHtml)=='undefined'){
	sliderjs += '<link href="<%=sname%>mf-pattern/'+sliderSkin+'.css" rel="stylesheet" type="text/css" />';
	sliderjs += '<script type="text/javascript" src="<%=sname%>myfocus-2.0.4.min.js"></script>';
	sliderjs += '<script type="text/javascript" src="<%=sname%>myFocus.easing.2.0.js"></script>';
	sliderjs += '<script type="text/javascript" src="<%=sname%>mf-pattern/'+sliderSkin+'.js"></script>';
	window.mkSliderHtml=function(pic,link,text,width,height,key){
		var p = pic.split('|'),l = link.split('|'),t = text.split('|');
		var html = '';
		html+='<div id="myFocus_'+key+'" style="width:'+width+'px;height:'+height+'px;"><div class=loading><span>加载中请稍候...</span></div><div class="pic"><ul>';
		for(var i=0,d=p.length;i<d;i++){
		html+='<li><a href="'+l[i]+'" target="_blank"><img src="'+p[i]+'" alt="'+t[i]+'" height="'+height+'" width="'+width+'" thumb="" /></a></li>';
		}
		html+='</ul></div></div>';
		return html;
	}
}else{
	sliderKey++;
}

(function(focus_width,focus_height,pics,links,texts,sliderKey,sliderjs){
	if(pics=='') return;
	if(sliderjs!=''){
		document.write(sliderjs);
	}else{
		sliderKey++;
	}
	document.write(mkSliderHtml(pics,links,texts,focus_width,focus_height,sliderKey));
	var c1 = setInterval(function(){
		if(typeof(myFocus)=='function'){
			clearInterval(c1);
			myFocus.set({
				id:'myFocus_'+sliderKey,
				pattern:sliderSkin,
				time:4,					//切换时间，单位秒
				txtHeight:'default',	//文字层高度(单位像素),0表示隐藏文字层,省略设置或'default'即为默认高度
				trigger:'click',		//触发切换模式['click'(鼠标点击)|'mouseover'(鼠标悬停)]
				auto:true,				//是否自动播放(切换)[true|false]
				index:0,				//开始显示的图片序号(从0算起)
				wrap:true,				//是否保留边框(有的话)[true|false]
				delay:100,				//trigger为'mouseover'模式下的切换延迟(单位毫秒)
				direction:'random',		//（皮肤定义参数）切出方向,可选：'random'(随机) | 'single'(单向/向右)
				easing:'easeOut',
				width:focus_width,
				height:focus_height
			});
		}
	},20);
})(<%=f_Width%>,<%=f_Height%>,'<%=FocusPic%>','<%=FocusUrl%>','<%=FocusText%>',sliderKey,sliderjs);
<%
Call FKFun.PageEnd()
%>
